﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NewsMine.DomainObjects;
using NewsMine.Storage;

namespace NewsDiscoveryEngine
{
    [Serializable]
    public class HintWebUrl2WebSiteInfoCollector : BaseJobWorkFlow
    {
        /*
         * Create HintUrlJob
         * Read HitUrlQueue =>
         * Download single html content of the given hint url =>
         * move this to UI Queue to find the website information along with menus and rss feeds.
         * Save website
         * save menu
         * save rss link
         * */

        public override void Initialize()
        {

        }


        public override void ProcessOutput(BaseJob job, object outputData)
        {
            if (job == null)
                return;

            if ((job is HtmlDownloadJob))
            {
                var htmlLinksJob = new HtmlString2LinksJob();
                List<HtmlLink> links = HtmlString2LinksJob.GetLinksFromHtmlContent((HtmlContentFromUrl)outputData);
                var newJob = new WebSiteInfoApprovalJob{HtmlLinks=links};
                Defaults.UIQueue.Enqueue(newJob);
            }
        }
    }

   



}


